import axios from "@/utils/http";
enum Api {
    user = "/v1/admin/user",
    point = "/v1/admin/user/point",
    disable = "/v1/admin/user/disable"
}
export interface User {
    updateTime: string;
    uUID: string;
    nickName: string;
    account: string;
    phone: string;
    sex: string;
    address: string;
    disable: number;
    picture: string;
    points: string;
    roleUUID: string;
    roleName: string;
}
interface RespUserList {
    list: User[];
    total: number;
}
interface UserPint {
    // 1: 增加 0: 减少
    way: number;
    // 积分
    point: number;
    // 用户UUID
    userUuid: string;
    // 根用户UUID
    rootUuid?: string;
}
export interface ListParmas {
    page?: number;
    pageSize?: number;
    keyword: string;
}
interface disableParams {
    uuid: string;
    // 状态 1: 启用 2: 禁用
    status: number;
}

export const disable = (params: disableParams) => {
    return axios.post(Api.disable, params);
};
export const Pint = (params: UserPint) => {
    return axios.post<{ message: string }>(Api.point, params);
};
export const List = (params: ListParmas) => {
    return axios.get<RespUserList>(Api.user, params);
};

// 获取用户详情
export const details = (uuid: string) => {
    return axios.get<User>(Api.user + "/" + uuid);
};

// 更新用户
export const Update = (params: User) => {
    return axios.put(Api.user, params);
};

// 删除用户
export const Delete = (uuid: string) => {
    return axios.delete(Api.user + "/" + uuid);
};

// 创建用户
export const Create = (params: User) => {
    return axios.post(Api.user, params);
};
